<template>
	<view class="container">
		<view class="g-list" v-if="orderData">
			<view class="item" v-for="(item,i) in orderData.goods" :key="item.id">
				<image :src="$img_base_url(item.image)" mode="aspectFill"></image>
				<view class="info">
					<view class="title one-row">
						{{item.title}}
					</view>
					<view class="spec">
						{{item.difference}}
					</view>
					<view class="btn">
						<button @click="toForm(item)">评价</button>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const FormData = require('@/utils/formdata/index.js')
	import { 
		goodsOrderInfo
	} from '@/utils/api/mallApi.js'
	export default {
		data() {
			return {
				order_id:null,
				orderData:null
			};
		},
		onLoad(options) {
			this.order_id = options.id
			this.getOrderInfo()
		},
		methods:{
			getOrderInfo(){
				let formData = new FormData()
				formData.append('id',this.order_id)
				uni.showLoading()
				// goodsOrderInfo(formData.getData()).then(res=>{
				goodsOrderInfo({id:this.order_id}).then(res=>{
					uni.hideLoading()
					this.orderData = res.data
				})
			},
			toForm(data){
				uni.navigateTo({
					url:`/pagesMine/shopGoodsOrder/evaluate/from?order_id=${this.order_id}&shop_id=${this.orderData.shop_id}&goods=${JSON.stringify(data)}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.container{
	.g-list{
		padding: 0 22rpx;
		box-sizing: border-box;
		.item{
			margin-top: 20rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 0rpx 12rpx 2rpx rgba(223,223,223,0.16);
			border-radius: 20rpx;
			padding: 24rpx 18rpx 18rpx 24rpx;
			box-sizing: border-box;
			display: flex;
			image{
				width: 180rpx;
				height: 180rpx;
			}
			.info{
				width: calc(100% - 180rpx);
				padding-left: 20rpx;
				box-sizing: border-box;
				.title{
					font-weight: bold;
					font-size: 32rpx;
					color: #333333;
					line-height: 44rpx;
					padding-top: 12rpx;
				}
				.spec{
					font-weight: 400;
					font-size: 28rpx;
					color: #505050;
					line-height: 40rpx;
					margin-top: 20rpx;
				}
				.btn{
					display: flex;
					justify-content: flex-end;
					margin-top: 14rpx;
					button{
						width: 144rpx;
						height: 54rpx;
						background: #FFFFFF;
						border-radius: 38rpx 38rpx 38rpx 38rpx;
						border: 2rpx solid #E72A2A;
						font-weight: 400;
						font-size: 30rpx;
						color: #E72A2A;
						line-height: 54rpx;
					}
				}
			}
		}
	}
}
</style>
